﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Petra.Gis.Geometry.Image.Tiff
{
  public partial class ImageFileDirectory
  {

    internal void checkBitsPerSample(Tag tag)
    {
      if (!tag.isInt())
      {
        throw new InvalidFileStructureException("Bits per " +
          "sample value(s) must be byte/short/long; type=" +
          tag.Type);
      }
      if (tag.Count == 1)

      for (int i = 0; i < tag.Count; i++)
      {
        if (tag.getElementAsInt(i) < 1)
        {
          throw new InvalidFileStructureException("Bits per " +
            "sample value #" + i + " is smaller than 1.");
        }
      }

    }
  }
}
